﻿@model Sykj.Entity.Users
@{
    ViewData["Title"] = "基本资料";
    Layout = "~/Areas/Manager/Views/Shared/_Layout.cshtml";
}
@section scriptstop
    {
    <link href="~/layuiadmin/formSelects-v4.css" rel="stylesheet" />
}
<div class="layui-fluid">
    <div class="layui-row layui-col-space15">
        <div class="layui-col-md12">
            <div class="layui-card">
                <div class="layui-card-header">设置我的资料</div>
                <div class="layui-card-body">
                    <div class="layui-form">
                        <div class="layui-form-item">
                            <label class="layui-form-label">我的角色</label>
                            <div class="layui-input-inline">
                                <select xm-select="RoleIds" asp-for="RoleIds" asp-items="@ViewBag.RolesList" disabled></select>
                            </div>
                            <div class="layui-form-mid layui-word-aux">*当前角色不可更改为其它角色</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">用户名</label>
                            <div class="layui-input-inline">
                                <input type="text" asp-for="UserName" lay-verify="title" disabled class="layui-input">
                            </div>
                            <div class="layui-form-mid layui-word-aux">*不可修改，一般用于后台登入名</div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">昵称</label>
                            <div class="layui-input-inline">
                                <input type="text" asp-for="NickName" class="layui-input" lay-verify="required">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">性别</label>
                            <div class="layui-input-block">
                                <input type="radio" name="Sex" value="男" title="男" asp-for="Sex">
                                <input type="radio" name="Sex" value="女" title="女" asp-for="Sex">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">头像</label>
                            <div class="layui-input-block">
                                <div class="layui-upload">
                                    <button type="button" class="layui-btn" id="img">上传图片</button>
                                    <div class="layui-upload-list">
                                        <img class="layui-upload-img" id="imgShow" src="@BaseConfig.ImagesDoMain@Model.Gravatar" style="width:100px;height:100px;">
                                        <p id="demoText"></p>
                                        <input type="hidden" name="Gravatar" id="Gravatar" asp-for="Gravatar">
                                    </div>
                                </div>
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">手机</label>
                            <div class="layui-input-inline">
                                <input type="text" asp-for="Phone" class="layui-input" lay-verify="phone">
                            </div>
                        </div>
                        <div class="layui-form-item">
                            <label class="layui-form-label">邮箱</label>
                            <div class="layui-input-inline">
                                <input type="text" asp-for="Email" class="layui-input" lay-verify="email">
                            </div>
                        </div>

                        <div class="layui-form-item">
                            <div class="layui-input-block">
                                <button class="layui-btn" lay-submit lay-filter="edit" id="submit" type="button">确认修改</button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>

@section scriptsfeet
        {
    <script type="text/javascript">
    layui.config({
        base: '/layuiadmin/'
    }).extend({
        formSelects: 'formSelects-v4'
    }).use(['form', 'formSelects', 'layer','upload', 'sykjwh'], function () {
        var $ = layui.$,
            form = layui.form,
            formSelects = layui.formSelects,
            upload = layui.upload, //上传
            sykjwh = layui.sykjwh;

          //普通图片上传
            upload.render({
                elem: '#img'
                , url: "@BaseConfig.ImagesDoMain"+'/Upload/Images'
                , data: { type: 'none' }
                , accept: 'file'
                , done: function (res) {
                    if (res.success === true) {
                        //上传成功
                        $("#Gravatar").val(res.data.path);
                        $('#imgShow').attr('src', "@BaseConfig.ImagesDoMain"+res.data.path);
                    }
                    else {
                        return layer.msg(res.msg);
                    }
                }
            });

            //确认修改
        form.on('submit(edit)', function (obj) {
            //保存
            sykjwh.save('@Url.Action("info", "users", new { area = Constant.AREAMANAGER })', obj.field);
        });
    });
    </script>
}
